﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace MINERP.NewProductBigPic
{
    public partial class FrmSetBarCodeSeque : Form
    {
        List<Myt> allTname = new List<Myt>();
        int index = 1;
        class Myt
        {
            public string Name { get; set; }
            public int Index { get; set; }
        }

        public FrmSetBarCodeSeque()
        {
            InitializeComponent();
        }

        private void FrmSetBarCodeSeque_Load(object sender, EventArgs e)
        {
            string[] Tnames = Properties.Settings.Default.BarCodeString.Split(new char[] { ',' });
            foreach (var tn in Tnames)
            {

                allTname.Add(new Myt()
                {
                    Index = index,
                    Name = tn

                });
            }
            gridControl1.DataSource = allTname;
        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            StringBuilder sb = new StringBuilder();
            foreach (var t in allTname.OrderBy(t=>t.Index).ToList())
            {
                sb.Append(t.Name + ",");
            }
            sb.Remove(sb.Length - 2, 1);
            Properties.Settings.Default.BarCodeString = sb.ToString();
        }

        private void btnUP_Click(object sender, EventArgs e)
        {

        }
    }
}
